Ext.onReady(function(){
	
	areaNotFindUseUpiswriteidb= Ext.get('areaNotFindUseUpiswriteid').getValue()==1?true:false;
	var areaNotFindUseUpBeginTimeField=new Ext.form.DateField({
		fieldLabel:'起止时间',
		value:new Date(),
		width:120
	});
	
	var areaNotFindUseUpEndTimeField=new Ext.form.DateField({
		fieldLabel:'结束时间',
		value:new Date(),
		width:120
	});
	var areaNotFindUseUpMoblieField=new Ext.form.TextField({
		fieldLabel:'用户手机号码',
		labelAlign:'right'
	});
	
	var areaNotFindUseUpSearchBtn=new Ext.Button({
		text:'查询',
		handler:function(){
			areaNotFindUseUpGridStore.load({
				params : {
					start : 0,
					limit : 20,
					'smobileNo':areaNotFindUseUpMoblieField.getValue(),
					'begintime':areaNotFindUseUpBeginTimeField.getValue(),
					'endtime':areaNotFindUseUpEndTimeField.getValue()
				}
			});
		}
	});
	
	var areaNotFindUseUpSearch=new Ext.Panel({
		height:50,
		region:'north',
		layout:'column',
		frame: true,
		border:false,
		bodyBorder:false,
		items:[
			{columnWidth:.27,layout:'form',labelAlign:'right',items:[areaNotFindUseUpBeginTimeField]},
			{columnWidth:.27,layout:'form',labelAlign:'right',items:[areaNotFindUseUpEndTimeField]},
			{columnWidth:.27,layout:'form',labelAlign:'right',items:[areaNotFindUseUpMoblieField]},
			{columnWidth:.15,layout:'form',labelAlign:'right',items:[areaNotFindUseUpSearchBtn]}]		
	});
	
	 areaNotFindUseUpGridStore = new Ext.data.Store({
        autoLoad: false,
        proxy : new Ext.data.HttpProxy({
            url: 'searchAreaNotFindUseUp.do'
        }),
        baseParams:{sName: areaNotFindUseUpMoblieField.getValue()},
        reader:new Ext.data.JsonReader({
             totalProperty: 'totalSize',
             root:'list'
        },[
            {name: 'nupMsgId',mapping:'nupMsgId', type: 'int'},
        	{name: 'sid',mapping:'sid',   type: 'string'},
        	{name: 'sspId',mapping:'sspId', type: 'string'},
        	{name: 'simsi',mapping:'simsi', type: 'string'},
        	{name: 'ssc',mapping:'ssc', type: 'string'},
        	{name: 'sv',mapping:'sv', type: 'string'},
        	{name: 'spkg',mapping:'spkg', type: 'string'},
        	{name: 'smobileNo',mapping:'smobileNo', type: 'string'},
        	{name: 'screateTime',mapping:'screateTime', type: 'string'}
        ])      
    });
					
	areaNotFindUseUpGridStore.on("beforeload", function(thiz, options) {
		thiz.baseParams["smobileNo"] = areaNotFindUseUpMoblieField.getValue(); 
		thiz.baseParams["begintime"] = areaNotFindUseUpBeginTimeField.getValue();
		thiz.baseParams["endtime"] = areaNotFindUseUpEndTimeField.getValue();
	});
	var areaNotFindUseUpGridBar=new Ext.PagingToolbar({
		store: areaNotFindUseUpGridStore,
		displayInfo: true,
		pageSize:20,
		displayMsg : '显示第 {0} 条到 {1} 条记录，一共 {2} 条',
		emptyMsg: "没有记录可以显示",
		beforePageText:'当前页码',
		afterPageText:'共{0}页', 
		firstText:'第一页', 
		prevText:'上一页', 
		nextText:'下一页', 
		lastText:'最后一页', 
		refreshText:'刷新当前页',
		items:['-', '仅显示没有归属地的用户更新记录']
     });
     
	areaNotFindUseUpGrid = new Ext.grid.GridPanel({
        store: areaNotFindUseUpGridStore,
        region:'center',
        bodyBorder:false,
        stripeRows:true,
		disableSelection: true,
		border:false,
		frame:true,
		loadMask :{msg:"数据加载中，请稍等..."},
		layout:'fit',
		viewConfig:{
			forceFit: true,
			scrollOffset:0
		},
        cm:new Ext.grid.ColumnModel([
        	new Ext.grid.RowNumberer(),
            {header: "序号", width:40, dataIndex: 'nupMsgId', sortable: true},
            {header: "ID", width:30, dataIndex: 'sid', sortable: true},
            {header: "SpId",width:50,align:'center', dataIndex: 'sspId', sortable: true},
            {header: "手机号", flex:2,align:'center', dataIndex: 'smobileNo', sortable: true},
            {header: "Imsi", flex:2,align:'center', dataIndex: 'simsi', sortable: true},
            {header: "Sc", flex:2, align:'center',dataIndex: 'ssc', sortable: true},
            {header: "V", width:50, dataIndex: 'sv', sortable: true},
            {header: "Pkg", width:50,align:'center', dataIndex: 'spkg', sortable: true},
            {header: "添加时间", flex:2,align:'center', dataIndex: 'screateTime', sortable: true}
        ]),
        bbar: areaNotFindUseUpGridBar
    });
    
    
	 var areaNotFindUseUpMainPanel =new Ext.Viewport({
		layout:'border',
		renderTo:'areaNotFindUseUpDIV',
		id:'areaNotFindUseUpMainPanel',
		items:[areaNotFindUseUpGrid,areaNotFindUseUpSearch],
		listeners: {
	        'resize': function(viewport,adjWidth,adjHeight,rawWidth,rawHeight)  {
	          	Ext.getCmp("areaNotFindUseUpMainPanel").setHeight((document.body.clientHeight - 290) * 0.67);  
			}
    	}
	});
});